Optimal. Leaf size=99 \[ \frac {(A-2 B) x}{a^2}-\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}-\frac {(A-2 B) \sin (c+d x)}{a^2 d (1+\cos (c+d x))}+\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 99, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {3056, 3047,
3102, 12, 2814, 2727} \begin {gather*} -\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}-\frac {(A-2 B) \sin (c+d x)}{a^2 d (\cos (c+d x)+1)}+\frac {x (A-2 B)}{a^2}+\frac {(A-B) \sin (c+d x) \cos ^2(c+d x)}{3 d (a \cos (c+d x)+a)^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 2727
Rule 2814
Rule 3047
Rule 3056
Rule 3102
Rubi steps
\begin {align*} \int \frac {\cos ^2(c+d x) (A+B \cos (c+d x))}{(a+a \cos (c+d x))^2} \, dx &=\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {\int \frac {\cos (c+d x) (2 a (A-B)-a (A-4 B) \cos (c+d x))}{a+a \cos (c+d x)} \, dx}{3 a^2}\\ &=\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {\int \frac {2 a (A-B) \cos (c+d x)-a (A-4 B) \cos ^2(c+d x)}{a+a \cos (c+d x)} \, dx}{3 a^2}\\ &=-\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}+\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {\int \frac {3 a^2 (A-2 B) \cos (c+d x)}{a+a \cos (c+d x)} \, dx}{3 a^3}\\ &=-\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}+\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {(A-2 B) \int \frac {\cos (c+d x)}{a+a \cos (c+d x)} \, dx}{a}\\ &=\frac {(A-2 B) x}{a^2}-\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}+\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}-\frac {(A-2 B) \int \frac {1}{a+a \cos (c+d x)} \, dx}{a}\\ &=\frac {(A-2 B) x}{a^2}-\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}+\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}-\frac {(A-2 B) \sin (c+d x)}{d \left (a^2+a^2 \cos (c+d x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.76, size = 137, normalized size = 1.38 \begin {gather*} \frac {2 \cos \left (\frac {1}{2} (c+d x)\right ) \left ((A-B) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right )-2 (5 A-8 B) \cos ^2\left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right )+6 \cos ^3\left (\frac {1}{2} (c+d x)\right ) ((A-2 B) d x+B \sin (c+d x))+(A-B) \cos \left (\frac {1}{2} (c+d x)\right ) \tan \left (\frac {c}{2}\right )\right )}{3 a^2 d (1+\cos (c+d x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.14, size = 106, normalized size = 1.07
method | result | size |
derivativedivides | \(\frac {\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A}{3}-\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) B}{3}-3 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+5 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\frac {4 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+4 \left (A -2 B \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) | \(106\) |
default | \(\frac {\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A}{3}-\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) B}{3}-3 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+5 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\frac {4 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+4 \left (A -2 B \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) | \(106\) |
risch | \(\frac {x A}{a^{2}}-\frac {2 B x}{a^{2}}-\frac {i {\mathrm e}^{i \left (d x +c \right )} B}{2 a^{2} d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} B}{2 a^{2} d}-\frac {2 i \left (6 A \,{\mathrm e}^{2 i \left (d x +c \right )}-9 B \,{\mathrm e}^{2 i \left (d x +c \right )}+9 A \,{\mathrm e}^{i \left (d x +c \right )}-15 B \,{\mathrm e}^{i \left (d x +c \right )}+5 A -8 B \right )}{3 d \,a^{2} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )^{3}}\) | \(130\) |
norman | \(\frac {\frac {\left (A -2 B \right ) x}{a}+\frac {\left (A -2 B \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {3 \left (A -3 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d a}+\frac {3 \left (A -2 B \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {3 \left (A -2 B \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {\left (A -2 B \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}+\frac {\left (A -B \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d a}-\frac {\left (4 A -9 B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}-\frac {\left (13 A -34 B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d a}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3} a}\) | \(218\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 191 vs.
\(2 (95) = 190\).
time = 0.48, size = 191, normalized size = 1.93 \begin {gather*} \frac {B {\left (\frac {\frac {15 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {24 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a^{2}} + \frac {12 \, \sin \left (d x + c\right )}{{\left (a^{2} + \frac {a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - A {\left (\frac {\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {12 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a^{2}}\right )}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.34, size = 117, normalized size = 1.18 \begin {gather*} \frac {3 \, {\left (A - 2 \, B\right )} d x \cos \left (d x + c\right )^{2} + 6 \, {\left (A - 2 \, B\right )} d x \cos \left (d x + c\right ) + 3 \, {\left (A - 2 \, B\right )} d x + {\left (3 \, B \cos \left (d x + c\right )^{2} - {\left (5 \, A - 14 \, B\right )} \cos \left (d x + c\right ) - 4 \, A + 10 \, B\right )} \sin \left (d x + c\right )}{3 \, {\left (a^{2} d \cos \left (d x + c\right )^{2} + 2 \, a^{2} d \cos \left (d x + c\right ) + a^{2} d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 411 vs.
\(2 (90) = 180\).
time = 1.26, size = 411, normalized size = 4.15 \begin {gather*} \begin {cases} \frac {6 A d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {6 A d x}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {A \tan ^{5}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {8 A \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {9 A \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {12 B d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {12 B d x}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {B \tan ^{5}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {14 B \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {27 B \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} & \text {for}\: d \neq 0 \\\frac {x \left (A + B \cos {\left (c \right )}\right ) \cos ^{2}{\left (c \right )}}{\left (a \cos {\left (c \right )} + a\right )^{2}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.45, size = 119, normalized size = 1.20 \begin {gather*} \frac {\frac {6 \, {\left (d x + c\right )} {\left (A - 2 \, B\right )}}{a^{2}} + \frac {12 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} a^{2}} + \frac {A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 9 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 15 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.26, size = 105, normalized size = 1.06 \begin {gather*} \frac {x\,\left (A-2\,B\right )}{a^2}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {A-B}{a^2}+\frac {A-3\,B}{2\,a^2}\right )}{d}+\frac {2\,B\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a^2\right )}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (A-B\right )}{6\,a^2\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________